package net.cherrylab.war.view
{
	import flash.display.Sprite;
	import flash.events.Event;
	
	public class DrawLine extends Sprite
	{
		private var baseX:Number;
		private var baseY:Number;
		private var _angle:Number;
		private var r:Number;
		private var l:Number;
		
		public function DrawLine() {
			this.r=50;
			this.l=100;
			this._angle=0;
			
			this.baseX = 400;
			this.baseY = 400;
			
			var p1:Number = this.baseX + Math.cos(this._angle) * Math.sin(this.r) * this.l;
			var p2:Number = this.baseY + Math.sin(this._angle) * Math.sin(this.r)* this.l;
			graphics.moveTo(p1,p2);
			graphics.lineStyle(1);
			
			addEventListener(Event.ENTER_FRAME, this.onEnterFrame);
		}// end function
		
		private function onEnterFrame(e:Event):void {
			var x0:Number = this.baseX + Math.cos(this._angle) * Math.sin(this.r) * this.l;
			var y0:Number = this.baseY + Math.sin(this._angle) * Math.sin(this.r)* this.l;
			this._angle += 1;
			graphics.lineTo(x0,y0);
			this.r+=5;
			return;
		}// end function
	}
}